home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / utils / fmgr / assoc_int.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  1.7 KB  |  48 lines

  1. /* ----------------------------------------------------------------
  2.  *    assoc_int.c
  3.  *
  4.  *    $Header: /private/postgres/src/utils/fmgr/RCS/assoc_int.h,v 1.3 1989/10/05 15:13:45 cimarron Exp $
  5.  * ----------------------------------------------------------------
  6.  */
  7. /**********************************************************************\
  8. **                                      **
  9. ** internal data types... not for use by the mortal man.. subject to  **
  10. ** changes..  information hiding and all that, don't you know.          **
  11. **                                      **
  12. \**********************************************************************/
  13.  
  14. typedef int* H_memory_cell;/* pointers to user's memory area. */
  15.  
  16. typedef H_memory_cell entry;  
  17.  
  18. typedef entry hash_table[];
  19.  
  20. typedef struct assoc_mem_rec
  21.     { hash_table *array; 
  22.        int value_size;   /* User defined size of data values; */
  23.       int size;      /* Number of slots in table.. power of 2 */
  24.       int size_div_2; /* always = size / 2 */
  25.       int mask;      /* always = size-1, for calculating (num mod size)*/
  26.       int entries;    /* number of entries in assoc mem */
  27.     }
  28.      * assoc_memory;
  29.  
  30.  
  31. /* Get unique stored string associated with a memory cell */
  32.  
  33. #define str_from_cell(cell,table) \
  34.     ((char*) (((char*) (cell))  + (table)->value_size))
  35.  
  36. /* Get memory cell associated with a string returned from string_from_cell*/
  37.  
  38. #define cell_from_str(string,table) \
  39.     ((int*)  (((char*) (string)) - (table)->value_size))
  40.  
  41. #define mem_from_cell(cell) ((int*)    ((char*)(cell) - sizeof(entry)))
  42. #define cell_from_mem(mem)  ((mem_cell)((char*)(mem)  + sizeof(entry)))
  43.  
  44. #define INIT_TABLE_SIZE 8 /* Must be a power of two */
  45. /*************************************************************************
  46. *************************************************************************/
  47.  
  48.